package com.usian.comment.controller;

import com.usian.comment.service.ApCommentService;
import com.usian.model.comment.dto.CommentDto;
import com.usian.model.comment.dto.CommentSaveDto;
import com.usian.model.common.dtos.ResponseResult;
import comment.ApCommentControllerApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/comment")
public class ApCommentController implements ApCommentControllerApi {

    @Autowired
    private ApCommentService apCommentService;

    /**
     * 保存用户评论信息
     *
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/save")
    public ResponseResult saveComment(@RequestBody CommentSaveDto dto) {
        return apCommentService.saveComment(dto);
    }


    /**
     * 查询所有评论列表
     *
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/load")
    public ResponseResult findByArticleId(@RequestBody CommentDto dto) {
        return apCommentService.findByArticleId(dto);
    }

}
